<div class="row">
	<div class="col-sm-8">
		<div class="page-header">
			<h2>任务:{{task.name}}
			<small class="text-danger" ng-show="task.draft">[草稿]</small></h2>
		</div>
		<button class="btn btn-danger pull-right"
			ng-hide="isRemoving"
			ng-click="isRemoving=true">删除</button>
		<div class="input-group pull-right" style="width:220px" ng-show="isRemoving">
			<span class="input-group-btn">
				<button class="btn btn-primary"
					ng-click="isRemoving=false">取消</button>
			</span>
			<form ng-submit="removeTaskEnter()" style="margin:0">
				<input type="text" class="form-control"
					placeholder="输入 DELETE" ng-model="deleteWord" />
			</form>
			<span class="input-group-btn">
				<button class="btn btn-danger"
					ng-click="removeTask()"
					ng-disabled="deleteWord!=='DELETE'">确定</button>
			</span>
		</div>
		<h3>属性</h3>
		<form ng-submit="updateTask()">
			<div class="row">
				<div class="form-group col-sm-4">
					<label for="">当前项目版本</label>
					<input class="form-control" type="text"
						readonly value="{{project.version}}" />
				</div>
				<div class="form-group col-sm-4">
					<label for="">任务定义版本</label>
					<input class="form-control" type="text"
						readonly value="{{task.version}}" />
				</div>
				<div class="form-group col-sm-4">
					<label for="">创建日期</label>
					<input class="form-control" type="text"
						readonly value="{{task.createtime|date:'yyyy-MM-dd HH:mm:ss'}}" />
				</div>
			</div>
			<div class="form-group">
				<label>注释</label>
				<textarea class="form-control" ng-model="taskComment"></textarea>
			</div>
			<button class="btn btn-primary"
				type="submit"
				ng-disabled="taskComment===task.comment">保存修改</button>
		</form>

		<div ng-hide="task.draft">
			<h3>测试报告</h3>
			<table class="table table-striped">
				<thead>
					<tr><th></th><th>报告名</th><th>运行版本</th><th>上传时间</th></tr>
				</thead>
				<tbody>
					<tr ng-hide="resultList.length">
						<td colspan="4">尚无测试报告</td>
					</tr>
					<tr ng-repeat="r in resultList">
						<td><input type="checkbox"
							ng-model="resultSelection[$index]" /></td>
						<td>{{r.name}}</td>
						<td>{{r.version}}</td>
						<td>{{r.createtime|date:'yyyy-MM-dd'}}</td>
					</tr>
				</tbody>
			</table>
			<a ng-href="#/project/{{task.projectId}}/task/{{task.taskId}}/result"
				class="btn btn-primary">查看报告</a>
			<button class="btn btn-danger pull-right"
				ng-disabled="!(resultSelection|filter:true).length"
				ng-hide="isRemoveReport"
				ng-click="isRemoveReport=true">删除选中</button>
			<div class="input-group pull-right" ng-show="isRemoveReport" style="width:220px">
				<span class="input-group-btn">
					<button class="btn btn-primary"
						ng-click="isRemoveReport=false">取消</button>
				</span>
				<form ng-submit="removeReportEnter()" style="margin:0">
					<input type="text" class="form-control"
						placeholder="输入 DELETE" ng-model="deleteReportWord" />
				</form>
				<span class="input-group-btn">
					<button class="btn btn-danger"
						ng-click="removeReportEnter()"
						ng-disabled="deleteReportWord!=='DELETE'">确定</button>
				</span>
			</div>
		</div>

		<h3>计划</h3>
		<h4>配置</h4>
		<p>暂时没有内容</p>
		<h4>用例列表</h4>
		<table class="table table-striped">
			<thead><tr><th>用例名称</th></tr></thead>
			<tbody>
				<tr ng-hide="task.schemas.caseList.length">
					<td>空计划</td>
				</tr>
				<tr ng-repeat="c in task.schemas.caseList">
					<td><a ng-href="#/project/{{task.projectId}}/case/{{c.caseId}}">{{c.name}}</a></td>
				</tr>
			</tbody>
		</table>
	</div>
	<div id="sideBar" class="col-sm-3 col-sm-offset-1 hidden-xs">
		<div ng-show="task.draft">
			<h4>测试任务草稿</h4>
			<a class="btn btn-primary" target="_blank"
				ng-href="{{project.probePath}}#/?probe={{project.probeId}}&token={{token.token}}&panel=task&taskId={{task.taskId}}">
				<span class="glyphicon glyphicon-edit"></span>&nbsp;继续编辑</a>
			<p>该测试任务尚处于草稿状态，无法运行。您现在仍可以继续编辑改测试任务。</p>
			<p>如果您已经确认该任务可以运行，可以点击&nbsp;<code><strong>转为正式</strong></code>&nbsp;按钮将任务转为正式状态以用于运行</p>
			<h4>转为正式</h4>
			<button class="btn btn-danger" ng-click="setNotDraft()">转为正式</button>
			<p><em>注意：任务一旦转为正式将无法再进行编辑，但您仍然可以通过管理端，导入一个正式任务作为新任务的模板。</em></p>
		</div>
		<div ng-hide="task.draft">
			<h4>运行测试</h4>
			<p><a class="btn btn-default" ng-href="{{runnerUrl}}" target="_blank">
				<span class="glyphicon glyphicon-play"></span>&nbsp;启动任务</a></p>
			<p>复制启动地址（ctrl+c）</p>
			<textarea class="form-control"
				style="height:150px"
				form-selector
				ng-model="runnerUrl" readonly></textarea>
			<h4>在移动设备上运行测试</h4>
			<div>
				<qrcode data="{{runnerUrl}}" size="150" version="9"></qrcode>
			</div>
			<h4>基于该正式任务创建</h4>
			<a class="btn btn-primary" target="_blank"
				ng-href="{{project.probePath}}#/?probe={{project.probeId}}&token={{token.token}}&panel=task&taskId={{task.taskId}}">
				<span class="glyphicon glyphicon-edit"></span>&nbsp;创建</a>
			<p>使用该功能，您将基于这个现有的正式任务创建一个新的任务。新任务将按照用例库的最新状态更新计划中的测试用例</p>
			<p><em>注意：该操作不会对这个任务产生任何改动。</em></p>
		</div>
	</div>
</div>
